previous(object_name)
Returns the value of a variable at the previous integration time point. A previous statement is only valid for an algebraic variable or a derived variable. It should not be applied to an interface variable or independent variable.
Example 1:
state.Prev_U = previous(state.U);
"state.Prev_U" equals the value of "state.U" at the previous integrator time point.
Example 2:
state.Var_Time = independent.t; state.Prev_t = previous(state.time);
The "previous" function can not be applied to an independent or interface variable. Hint: declare a new temporary state temporary and assign to it the value of the independent or state variable:
state.temp_variable = independent.t; state.Prev_t = previous(state.temp_variable);